<template>
  <a-modal
    :title="title"
    :width="800"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleOk"
    @cancel="handleCancel"
    :footer="null"
    cancelText="关闭">

    <table id="table_report" class="table table-striped table-bordered table-hover">

           			<tr>
           				<td style="width:90px;text-align: right;padding-top: 80px;">基本信息:</td>
           				<td>
           					<p style="float: left;">


             车场编号：<span id="parkCode" >
           {{result.parkCode }}
                    </span><br>


             停车场名称：<span id="parkName" >
           {{result.parkName }}
                    </span><br>


             入场批次号：<span id="batchNumber" >
           {{result.batchNumber }}
                    </span><br>


             车牌号：<span id="plateNo" >
           {{result.plateNo }}
                    </span><br>


             车辆类型（ 0：未知车牌:、1：蓝牌小汽车、2：:黑牌小汽车、3：单排黄牌、4：双排黄牌、 5：警车车牌、6：武警车牌、7：个性化车牌、8：单排军车牌、9：双排军车牌、10：使馆车牌、11：香港进出中国大陆车牌、12：农用车牌、13：教练车牌、14：澳门进出中国大陆车牌、15：双层武警车牌、16：武警总队车牌、17：双层武警总队车牌、18：民航车牌、19：新能源车牌）',
：<span id="carTypeNo" >
           {{result.carTypeNo }}
                    </span><br>


             车辆本质(0:临时车,1:月租车,2储值车，3军警车，4白名单,5黑名单）：<span id="carNature" >
           {{result.carNature }}
                    </span><br>


             车辆入场ID：<span id="carEnterId" >
           {{result.carEnterId }}
                    </span><br>


             设备序列号，设备唯一：<span id="serialNo" >
           {{result.serialNo }}
                    </span><br>


             总费用：<span id="chargeTotalFee" >
           {{result.chargeTotalFee }}
                    </span><br>


             优惠券金额，单位：分：<span id="couponAmt" >
           {{result.couponAmt }}
                    </span><br>


             已支付费用；单位分：<span id="chargePaid" >
           {{result.chargePaid }}
                    </span><br>


             退款金额；单位分：<span id="refundFee" >
           {{result.refundFee }}
                    </span><br>


             抵扣金额；单位分：<span id="deductionFee" >
           {{result.deductionFee }}
                    </span><br>


             车辆进场时间：<span id="carEnterTime" >
           {{result.carEnterTime }}
                    </span><br>


             车辆出场时间：<span id="carOutTime" >
           {{result.carOutTime }}
                    </span><br>


             停车时长: 单位分：<span id="chargeDuration" >
           {{result.chargeDuration }}
                    </span><br>


             入场类型：0：默认 1：重复入场 2：手动入场 3：补录入场：<span id="enterType" >
           {{result.enterType }}
                    </span><br>


             出场类型 1 : 正常出场 2：手动出场 3：补录场内：<span id="outerType" >
           {{result.outerType }}
                    </span><br>


             入口设备：<span id="enterSerialNo" >
           {{result.enterSerialNo }}
                    </span><br>


             出口设备：<span id="outerSerialNo" >
           {{result.outerSerialNo }}
                    </span><br>


             修改时间：<span id="updateTime" >
           {{result.updateTime }}
                    </span><br>


             是否成功同步到云端 N:失败 Y:成功：<span id="synchronousStatus" >
           {{result.synchronousStatus }}
                    </span><br>


             入口工作站：<span id="enterWorkName" >
           {{result.enterWorkName }}
                    </span><br>


             入口操作人员：<span id="enterSysUserName" >
           {{result.enterSysUserName }}
                    </span><br>


             出口工作站：<span id="outWorkName" >
           {{result.outWorkName }}
                    </span><br>


             出口操作人员：<span id="outSysUserName" >
           {{result.outSysUserName }}
                    </span><br>

  创建时间：<span id="createTime" >
           {{result.createTime }}
                    </span><br>
	</p>
			</td>
                			</tr>

                				<tr>
                                    <td style="width:90px;text-align: right;padding-top: 60px;">详情:</td>
                                    <td>
                                        <p style="float: left;">


                                        </p>
                                    </td>
                            	</tr>

                			<tr>
                				<td style="text-align: center;" colspan="10">
                                 <a-button type="primary" @click="close">关闭</a-button>
                				</td>
                			</tr>
                		</table>

  </a-modal>
</template>

<script>
  import { httpAction } from '@/api/manage'
  import pick from 'lodash.pick'
  import moment from "moment"

  export default {
    name: "ParkCarOutEntranceRecordModal",
    data () {
      return {
        title:"操作",
        visible: false,
        model: {},
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },
         result: {

                },
        confirmLoading: false,
        form: this.$form.createForm(this),
        validatorRules:{
        synchronousStatus:{rules: [{ required: true, message: '请输入是否成功同步到云端 N:失败 Y:成功!' }]},
        outSysUserName:{rules: [{ required: true, message: '请输入出口操作人员!' }]},
        },
        url: {
          add: "/parkcaroutentrancerecord/parkCarOutEntranceRecord/add",
          edit: "/parkcaroutentrancerecord/parkCarOutEntranceRecord/edit",
        },
      }
    },
    created () {
    },
    methods: {
      add () {
        this.edit({});
      },
      edit (record) {
             Object.assign(this.result, record);
              this.visible = true;
            },
      close () {
        this.$emit('close');
        this.visible = false;
      },
      handleOk () {
        const that = this;
        // 触发表单验证
        this.form.validateFields((err, values) => {
          if (!err) {
            that.confirmLoading = true;
            let httpurl = '';
            let method = '';
            if(!this.model.id){
              httpurl+=this.url.add;
              method = 'post';
            }else{
              httpurl+=this.url.edit;
               method = 'put';
            }
            let formData = Object.assign(this.model, values);
            //时间格式化
            formData.updateTime = formData.updateTime?formData.updateTime.format('YYYY-MM-DD HH:mm:ss'):null;

            httpAction(httpurl,formData,method).then((res)=>{
              if(res.success){
                that.$message.success(res.message);
                that.$emit('ok');
              }else{
                that.$message.warning(res.message);
              }
            }).finally(() => {
              that.confirmLoading = false;
              that.close();
            })



          }
        })
      },
      handleCancel () {
        this.close()
      },


    }
  }
</script>

<style lang="less" scoped>

</style>